package com.yukh.framework.mybatis.generator.page.demo2;
import java.util.List;

import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.ShellRunner;

// http://kangzye.blog.163.com/blog/static/36819223201141992524864/
public class PaginationPlugin1 extends PluginAdapter {

	public boolean validate(List<String> warnings) {
		return true;
	}

	public static void generate() {
//		String config = PaginationPlugin1.class.getClassLoader().getResource("src/main/framework/com/yukh/framework/mybatis/generator/page/demo2/page-generator.xml").getFile();
		
		String config = PaginationPlugin1.class.getResource("page-generator.xml").getFile();
		String[] arg = { "-configfile", config, "-overwrite"};
		ShellRunner.main(arg);
	}

	public static void main(String[] args) {
//		generate();
		ClassLoader parent = Thread.currentThread().getContextClassLoader();
		
		String path = PaginationPlugin1.class.getResource("page-generator.xml").getPath();
		System.out.println(path);
	}
}
